home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / os.261 < prev    next >
Text File  |  1992-02-06  |  641b  |  33 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fswiss Helvetica;\f2\fmodern Courier;}
  2. \paperw11440
  3. \paperh9000
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ul0\fs28 os ethernet address hostid gethostid\
  7. \
  8. Q:  How do I convert a hostid into an Ethernet address?\
  9. \
  10. A:  Here is the code to decode a hostid:\
  11.  
  12. \f1\fs24 \
  13.  
  14. \f2 main()\
  15. \{\
  16.     long    hostid;\
  17.     long    en_address;\
  18.     \
  19.     hostid = gethostid();\
  20.     en_address = (hostid & 0xffffff) + 0x00000f000000;\
  21.     \
  22.     printf("hostid = 0x%x; en_address = 0x%x.\\n", hostid, en_address);\
  23. \}\
  24.     \
  25.  
  26. \f0\fs28 \
  27. QA261\
  28. \
  29. Valid for 1.0 \
  30. Valid for 2.0\
  31. \
  32.  
  33.